package com.lagou.life;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @author zyy
 * @date 2022/6/27 下午10:50
 * @description
 */
public class MyBeanPostProcessor implements BeanPostProcessor {
	private final static String BeanName = "lifeBean";

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		if (BeanName.equals(beanName)){
			System.out.println("LifeBean before方法拦截处理lifeBean");
		}
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		if (BeanName.equals(beanName)){
			System.out.println("LifeBean before方法拦截处理lifeBean");
		}
		return bean;
	}
}
